﻿@using CoreData
@using System.Text.RegularExpressions
@model IEnumerable<Article>
@if (Model!=null && Model.Count() > 0)
{
    var i = 0;
    <table cellpadding="0" cellspacing="0" width="100%" class="table" id="tSortablearticle">
        <thead>
            <tr>
                <th width="20px">
                </th>
                <th width="70px">Title</th>
                <th width="70px">Image</th>
                <th width="75px">Category</th>
             
                <th width="60px">Author</th>
                <th width="60px">Status</th>
                <th width="60px">Action
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                i++;
                <tr>
                    <td width="20px">
                        @i
                        <span class="SpanId" style="display: none;">@item.ID</span>
                    </td>
                    <td width="70px">
                        @item.Title
                    </td>
                    <td width="70px">
                        <img src="@Url.Content("~/Media/article/"+ item.Image)" width="70px" height="70px" alt="@item.Title" /></td>
                    <td width="75px">
                        @item.CategoryNameExt
                    </td>
                    
                    <td width="60px">
                        @item.UserNameExt
                    </td>
                    <td width="60px">
                        @Html.CheckBoxFor(x => item.Active, new { @disabled = "disabled" })
                    </td>
                    <td width="60px">
                     @if (Helper.SessionManagement.Value("pvalue").Contains("U"))
                     {
                        <a title="Update" href="@Url.Action("AddOrUpdate", "ArticleManagement", new { id = item.ID })" class="icon-pencil"></a>
                     }
                      @if (Helper.SessionManagement.Value("pvalue").Contains("D"))
                      {
                          if (item.ID == 12 || item.ID == 13)
                          {
                          }
                          else
                          {
                        <a title="Delete" href="@Url.Action("Delete", "ArticleManagement", new { id = item.ID })" class="icon-trash" onclick="return confirm('Do you want delete this merchant ?');"></a>
                          }
                      }
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <h2 class="error-text">Not any article here.
    </h2>
}